#ifndef LY_UDP_SOCKET_H
#define LY_UDP_SOCKET_H

#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>   
#include <sys/socket.h>   
#include <netinet/in.h>   
#include <arpa/inet.h>
#include <stdlib.h>

#define MAXLINE   1024

class UDPSocket {
public:
    UDPSocket(uint16_t server_port, uint16_t client_port, const char *client_ip);
    ~UDPSocket();
    void initUDPServer();
    void initUDPClinet();
    int UDPRecv();
    void UDPSend();
    void GetRecv(char *buf);
    int SetSend(char *buf);
    char recvBuf[MAXLINE];
    char sendBuf[MAXLINE];
private:
    int sock_fd; // socket文件描述符
    char *client_ip;
    char *sever_ip;
    uint16_t server_port;
    uint16_t client_port;
    // 设置address
    struct sockaddr_in addr_serv; 
    struct sockaddr_in addr_clie; 
};

#endif